package controllers.admin;

import models.admin.Module;
import play.mvc.With;
import controllers.BaseController;
import controllers.Check;
import controllers.Secure;

/**
 * @author rjanixz
 *
 */
@With(Secure.class)
public class Modules extends BaseController {

	@Check(value="ADD")
	public static void save(String name, String description) {
		Module module = new Module();
		module.setName(name);
		module.setDescription(description);
		module.save();
		redirect("/admin/modules/all");
	}
	
	@Check(value="EDIT")
	public static void update(Long moduleId, String name, String description) {
		Module module = Module.findById(moduleId);
		module.setName(name);
		module.setDescription(description);
		module.save();
		redirect("/admin/modules/all");
	}
}
